Description:
FUTV detects fields that are used as temporary variables. This means that a value assigned to such a field is not used by any method except for the method containing the assignment. A temporary field should be replaced by a local variable. FUTV examines only fields with private and internal access since public and protected fields may be used outside of the analyzed assembly.
Incorrect:
class Composite {
private int i;
void resize(Rect size) {
for (i = 0; i < numChildren(); i++) {
getChild(i).resize(size);
}
}
void draw() {
for (i = 0; i < numChildren(); i++) {
getChild(i).draw();
}
}
...
}
Correct:
class Composite {
void resize(Rect size) {
for (int i = 0; i < numChildren(); i++) {
getChild(i).resize(size);
}
}
void draw() {
for (int i = 0; i < numChildren(); i++) {
getChild(i).draw();
}
}
...
}